import React from 'react';
import { User } from './search-panel';
interface Project {
    id: string;
    name: string;
    personId: string;
    organization: string;
    created: number;
}

interface ListProps {
    list: Project[];
    users: User[];
}
const List = ({ list, users }: ListProps) => {
    return (
        <table>
            <thead>
                <tr>
                    <th>名称</th>
                    <th>负责人</th>
                </tr>
            </thead>
            <tbody>
                {list.map((project) => (
                    <tr key={project.id}>
                        <td>{project.name}</td>
                        <td>
                            {users.find(
                                (user: User) => user.id === project.personId
                            )?.username || '未知'}
                        </td>
                    </tr>
                ))}
            </tbody>
        </table>
    );
};

export default List;
